package training;

import java.util.Scanner;
// https://www.nowcoder.com/questionTerminal/754921e9c98b43d1b2d70c227b844101
// 注意类名必须为 test.Main, 不要有任何 package xxx 信息
public class Day32_01 {
    // 判断是否是闰年
    public static boolean isRYear(int y) {
        return (y % 400 == 0) || (y % 4 == 0 && y % 100 != 0);
    }

    // 计算一个整年的收入
    public static int yearSalary(int y) {
        int profit = (29 + 31 + 31 + 31 + 30) + 2 * (31 + 30 + 30 + 31 + 30 + 31 + 31);
        return isRYear(y) ? profit : profit - 1;
    }

    //判断y1年已有的收入
    public static int existSalary(int y1, int m1, int d1) {
        int sum = 0;
        // 计算当月的收入
        if (m1 == 2 || m1 == 3 || m1 == 5 || m1 == 7 || m1 == 11) {
            sum += d1;
        } else {
            sum += d1 * 2;
        }
        // 计算该年之前月的收入
        m1--;
        for (; m1 > 0; m1--) {
            switch (m1) {
                case 1:
                case 8:
                case 10:
                case 12:
                    sum += 2 * 31;
                    break;
                case 3:
                case 5:
                case 7:
                    sum += 31;
                    break;
                case 4:
                case 6:
                case 9:
                    sum += 30 * 2;
                    break;
                case 11:
                    sum += 30;
                    break;
                default:
                    if (isRYear(y1)) {
                        sum += 29;
                    } else {
                        sum += 28;
                    }
            }
        }
        return sum;
    }
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        // 注意 hasNext 和 hasNextLine 的区别
        while (in.hasNextInt()) { // 注意 while 处理多个 case
            int y1 = in.nextInt();
            int m1 = in.nextInt();
            int d1 = in.nextInt();
            int y2 = in.nextInt();
            int m2 = in.nextInt();
            int d2 = in.nextInt();
            int profit = 0;
            // 计算第一年的收入
            profit += yearSalary(y1) - existSalary(y1, m1, d1-1);
            // 计算最后一年的收入
            profit += existSalary(y2, m2, d2);
            // 如果年份相同，换一下坐标轴图就知道了
            if(y1 == y2){
                profit -= yearSalary(y1);
            }
            // 计算中间年份的收入
            for (int i = y1 + 1; i < y2; i++) {
                profit += yearSalary(i);
            }
            System.out.println(profit);
        }
    }
}
